package com.cqupt.scanning.system.admin.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cqupt.scanning.system.admin.entity.PatientFoot;
import com.cqupt.scanning.system.admin.entity.PatientThree;
import com.cqupt.scanning.system.admin.entity.dto.PatientFootDTO;
import com.cqupt.scanning.system.admin.mapper.PatientThreeMapper;
import com.cqupt.scanning.system.admin.service.PatientThreeService;
import com.cqupt.scanning.system.utils.result.R;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 病人用户（前端展示） 服务实现类
 * </p>
 *
 * @author 宋宝梁
 * @since 2021-07-06
 */
@Service
public class PatientThreeServiceImpl extends ServiceImpl<PatientThreeMapper, PatientThree> implements PatientThreeService {

    @Override
    public R getAll(Page<PatientThree> page, String name,String sex,String phone,String doctor, String devNum, String orgName) {
        IPage<PatientThree> patientThreeIPage = baseMapper.selectPage(page, new QueryWrapper<PatientThree>()
                .like("name", name)
                .select("id", "name", "sex", "testTime","file_path","zip_file_path"));
//        QueryWrapper<PatientThree> w = new QueryWrapper<>();
//        if (!StrUtil.isEmpty(name)){
//            w.like("name",name);
//        }
//        if (!StrUtil.isEmpty(sex)){
//            w.eq("sex", sex);
//        }
//        if (!StrUtil.isEmpty(doctor)){
//            w.like("doctor",doctor);
//        }
//        if (!StrUtil.isEmpty(orgName)){
//            w.like("org_name",orgName);
//        }
//        if (!StrUtil.isEmpty(devNum)){
//            w.like("dev_num",devNum);
//        }
//        if(!StrUtil.isEmpty(phone)){
//            w.like("phone",phone);
//        }
//

        return R.ok().data("patients", patientThreeIPage);
    }
}
